/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AdministrarElecciones.java
 *
 * Created on 07-feb-2013, 21:46:13
 */
package inscripciones.vista;

import com.mycsistemas.swingec.panel.ImagePanel;
import java.util.ArrayList;
import java.util.Date;
import javax.swing.JTabbedPane;
//import sisvoto.DAO.ConsultasBD;
//import sisvoto.ModeloDAO.EleccionDAO;
//import sisvoto.ModeloDAO.EleccionElectorDAO;
//import sisvoto.ModeloDAO.EleccionListaDAO;
//import sisvoto.ModeloDAO.JornadaElectoralDAO;
//import sisvoto.Utiles.Mensajes;
//import sisvoto.modelo.Eleccion;
//import sisvoto.modelo.EleccionActual;
//import sisvoto.modelo.EleccionElector;
//import sisvoto.modelo.EleccionListas;
//import sisvoto.modelo.Elector;
//import sisvoto.modelo.JornadaElectoral;
//import sisvoto.modelo.PartidoElectoral;
//import sisvoto.modeloTablas.ModelTableElector;
//import sisvoto.modeloTablas.ModelTableJornadas;
//import sisvoto.modeloTablas.ModelTablePartido;

/**
 *
 * @author Dianita
 */
public class AdministrarJornada extends javax.swing.JDialog {

//    Eleccion eleccion;
//    ArrayList<JornadaElectoral> jornadas;
//    ArrayList<JornadaElectoral> jornadastemp;
//    JornadaElectoral jornadaselect = null;
//    ArrayList<EleccionElector> eleccionelectores;
//    ArrayList<EleccionListas> eleccionlistas;
//    final ArrayList<Elector> electores = new ArrayList<>();
//    final ArrayList<PartidoElectoral> listas = new ArrayList<>();

    /** Creates new form AdministrarElecciones */
    public AdministrarJornada(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
//        this.eleccion = new Eleccion();
//        this.jornadas = new ArrayList<>();
//        this.jornadastemp = new ArrayList<>();
//        this.eleccionelectores = new ArrayList<>();
//        this.eleccionlistas = new ArrayList<>();
        initComponents();
        jcbEstado.setSelectedIndex(0);
    }

//    public AdministrarElecciones(java.awt.Frame parent, boolean modal, Eleccion eleccion) {
//        super(parent, modal);
////        this.eleccion = eleccion;
////        this.jornadas = (ArrayList<JornadaElectoral>) new ConsultasBD().buscarPOR("JornadaElectoral", "eleccion", "'" + eleccion.getId() + "'");
////        this.jornadastemp = jornadas;
////        this.eleccionelectores = (ArrayList<EleccionElector>) new ConsultasBD().buscarPOR("EleccionElector", "eleccion", "'" + eleccion.getId() + "'");
////        this.eleccionlistas = (ArrayList<EleccionListas>) new ConsultasBD().buscarPOR("EleccionListas", "eleccion", "'" + eleccion.getId() + "'");
////        //elecylist();
//        initComponents();
////        listas.clear();
////        electores.clear();
////        actualizarTabla();
////        actualizarTablaElectores();
////        actualizarTablaListas();
//        desactivarcampos();
//        desactivarcampostotales();
//    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        imagePanel1 = new com.mycsistemas.swingec.panel.ImagePanel();
        curvesPanel1 = new com.mycsistemas.swingec.panel.CurvesPanel();
        jLblPartidoElectoral = new javax.swing.JLabel();
        jPanelCandidatos = new javax.swing.JPanel();
        jLblNombre = new javax.swing.JLabel();
        jLblAlias1 = new javax.swing.JLabel();
        jcbEstado = new javax.swing.JComboBox();
        txttitulo = new javax.swing.JTextField();
        jBtnNuevo = new javax.swing.JButton();
        btnNuevo = new javax.swing.JButton();
        jBtnNuevo2 = new javax.swing.JButton();
        jBtnNuevo3 = new javax.swing.JButton();
        btnGuardar = new javax.swing.JButton();
        jPanelCandidatos1 = new javax.swing.JPanel();
        jLblNombre2 = new javax.swing.JLabel();
        jdtFecha = new com.toedter.calendar.JDateChooser();
        jcbHH = new javax.swing.JComboBox();
        jLabel6 = new javax.swing.JLabel();
        jcbHM = new javax.swing.JComboBox();
        jLblNombre3 = new javax.swing.JLabel();
        jLblNombre4 = new javax.swing.JLabel();
        jcbDH = new javax.swing.JComboBox();
        jLabel7 = new javax.swing.JLabel();
        jcbDM = new javax.swing.JComboBox();
        btneliminarj = new javax.swing.JButton();
        BtnNuevoJ = new javax.swing.JButton();
        btnGuardarJ = new javax.swing.JButton();
        btnEdijarj = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblJornadas = new javax.swing.JTable();
        jBtnNuevo6 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Elecciones");
        setResizable(false);

        imagePanel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inscripciones/Recursos/''_10102012_1738.jpeg"))); // NOI18N

        curvesPanel1.setLayout(null);

        jLblPartidoElectoral.setFont(new java.awt.Font("Georgia", 3, 18));
        jLblPartidoElectoral.setForeground(new java.awt.Color(255, 255, 255));
        jLblPartidoElectoral.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLblPartidoElectoral.setText("Administración de Jornadas");
        curvesPanel1.add(jLblPartidoElectoral);
        jLblPartidoElectoral.setBounds(90, 20, 280, 30);

        jPanelCandidatos.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Jornada", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 0, 10), java.awt.Color.white)); // NOI18N
        jPanelCandidatos.setForeground(new java.awt.Color(255, 255, 255));
        jPanelCandidatos.setOpaque(false);
        jPanelCandidatos.setLayout(null);

        jLblNombre.setFont(new java.awt.Font("Elephant", 0, 14));
        jLblNombre.setForeground(new java.awt.Color(255, 255, 255));
        jLblNombre.setText("Título:");
        jPanelCandidatos.add(jLblNombre);
        jLblNombre.setBounds(30, 20, 70, 30);

        jLblAlias1.setFont(new java.awt.Font("Elephant", 0, 14));
        jLblAlias1.setForeground(new java.awt.Color(255, 255, 255));
        jLblAlias1.setText("Estado:");
        jPanelCandidatos.add(jLblAlias1);
        jLblAlias1.setBounds(30, 60, 80, 30);

        jcbEstado.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Activo", "Inactivo" }));
        jcbEstado.setEnabled(false);

        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${eleccion.estado}"), jcbEstado, org.jdesktop.beansbinding.BeanProperty.create("selectedItem"));
        bindingGroup.addBinding(binding);

        jPanelCandidatos.add(jcbEstado);
        jcbEstado.setBounds(110, 60, 240, 30);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${eleccion.titulo}"), txttitulo, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        jPanelCandidatos.add(txttitulo);
        txttitulo.setBounds(110, 20, 240, 30);

        curvesPanel1.add(jPanelCandidatos);
        jPanelCandidatos.setBounds(30, 60, 380, 100);

        jBtnNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inscripciones/Recursos/DeleteRed.png"))); // NOI18N
        jBtnNuevo.setText("Salir");
        jBtnNuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnNuevoActionPerformed(evt);
            }
        });
        curvesPanel1.add(jBtnNuevo);
        jBtnNuevo.setBounds(430, 380, 120, 50);

        btnNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inscripciones/Recursos/document_32.png"))); // NOI18N
        btnNuevo.setText("Nuevo");
        btnNuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNuevoActionPerformed(evt);
            }
        });
        curvesPanel1.add(btnNuevo);
        btnNuevo.setBounds(430, 80, 120, 50);

        jBtnNuevo2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inscripciones/Recursos/Pencil3.png"))); // NOI18N
        jBtnNuevo2.setText("Editar");
        jBtnNuevo2.setToolTipText("");
        jBtnNuevo2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnNuevo2ActionPerformed(evt);
            }
        });
        curvesPanel1.add(jBtnNuevo2);
        jBtnNuevo2.setBounds(430, 140, 120, 50);

        jBtnNuevo3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inscripciones/Recursos/trash_32.png"))); // NOI18N
        jBtnNuevo3.setText("Eliminar");
        jBtnNuevo3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnNuevo3ActionPerformed(evt);
            }
        });
        curvesPanel1.add(jBtnNuevo3);
        jBtnNuevo3.setBounds(430, 200, 120, 50);

        btnGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inscripciones/Recursos/save_32.png"))); // NOI18N
        btnGuardar.setText("Guardar");
        btnGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGuardarActionPerformed(evt);
            }
        });
        curvesPanel1.add(btnGuardar);
        btnGuardar.setBounds(430, 260, 120, 50);

        jPanelCandidatos1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Horario", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 0, 10), java.awt.Color.white)); // NOI18N
        jPanelCandidatos1.setForeground(new java.awt.Color(255, 255, 255));
        jPanelCandidatos1.setOpaque(false);
        jPanelCandidatos1.setLayout(null);

        jLblNombre2.setFont(new java.awt.Font("Elephant", 0, 14));
        jLblNombre2.setForeground(new java.awt.Color(255, 255, 255));
        jLblNombre2.setText("Hasta:");
        jPanelCandidatos1.add(jLblNombre2);
        jLblNombre2.setBounds(200, 60, 70, 30);
        jPanelCandidatos1.add(jdtFecha);
        jdtFecha.setBounds(80, 20, 280, 30);

        jcbHH.setFont(new java.awt.Font("Tahoma", 0, 10));
        jcbHH.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23" }));
        jPanelCandidatos1.add(jcbHH);
        jcbHH.setBounds(250, 60, 50, 30);

        jLabel6.setFont(new java.awt.Font("Elephant", 0, 14));
        jLabel6.setForeground(new java.awt.Color(255, 255, 255));
        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel6.setText(":");
        jPanelCandidatos1.add(jLabel6);
        jLabel6.setBounds(300, 60, 10, 30);

        jcbHM.setFont(new java.awt.Font("Tahoma", 0, 10));
        jcbHM.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59" }));
        jPanelCandidatos1.add(jcbHM);
        jcbHM.setBounds(310, 60, 50, 30);

        jLblNombre3.setFont(new java.awt.Font("Elephant", 0, 14));
        jLblNombre3.setForeground(new java.awt.Color(255, 255, 255));
        jLblNombre3.setText("Fecha:");
        jPanelCandidatos1.add(jLblNombre3);
        jLblNombre3.setBounds(20, 20, 120, 30);

        jLblNombre4.setFont(new java.awt.Font("Elephant", 0, 14));
        jLblNombre4.setForeground(new java.awt.Color(255, 255, 255));
        jLblNombre4.setText("Desde:");
        jPanelCandidatos1.add(jLblNombre4);
        jLblNombre4.setBounds(20, 60, 70, 30);

        jcbDH.setFont(new java.awt.Font("Tahoma", 0, 10));
        jcbDH.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23" }));
        jPanelCandidatos1.add(jcbDH);
        jcbDH.setBounds(80, 60, 50, 30);

        jLabel7.setFont(new java.awt.Font("Elephant", 0, 14));
        jLabel7.setForeground(new java.awt.Color(255, 255, 255));
        jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel7.setText(":");
        jPanelCandidatos1.add(jLabel7);
        jLabel7.setBounds(130, 60, 10, 30);

        jcbDM.setFont(new java.awt.Font("Tahoma", 0, 10));
        jcbDM.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59" }));
        jPanelCandidatos1.add(jcbDM);
        jcbDM.setBounds(140, 60, 50, 30);

        btneliminarj.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inscripciones/Recursos/trash_32.png"))); // NOI18N
        btneliminarj.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btneliminarjActionPerformed(evt);
            }
        });
        jPanelCandidatos1.add(btneliminarj);
        btneliminarj.setBounds(310, 220, 50, 40);

        BtnNuevoJ.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inscripciones/Recursos/document_32.png"))); // NOI18N
        BtnNuevoJ.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtnNuevoJActionPerformed(evt);
            }
        });
        jPanelCandidatos1.add(BtnNuevoJ);
        BtnNuevoJ.setBounds(310, 100, 50, 40);

        btnGuardarJ.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inscripciones/Recursos/save_32.png"))); // NOI18N
        btnGuardarJ.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGuardarJActionPerformed(evt);
            }
        });
        jPanelCandidatos1.add(btnGuardarJ);
        btnGuardarJ.setBounds(310, 140, 50, 40);

        btnEdijarj.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inscripciones/Recursos/Pencil3.png"))); // NOI18N
        btnEdijarj.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEdijarjActionPerformed(evt);
            }
        });
        jPanelCandidatos1.add(btnEdijarj);
        btnEdijarj.setBounds(310, 180, 50, 40);

        tblJornadas.setFont(new java.awt.Font("Tahoma", 0, 9));
        tblJornadas.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Fecha Inicio", "Fecha Final"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tblJornadas.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblJornadasMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tblJornadas);
        tblJornadas.getColumnModel().getColumn(0).setResizable(false);
        tblJornadas.getColumnModel().getColumn(1).setResizable(false);

        jPanelCandidatos1.add(jScrollPane1);
        jScrollPane1.setBounds(20, 100, 280, 160);

        curvesPanel1.add(jPanelCandidatos1);
        jPanelCandidatos1.setBounds(30, 170, 380, 280);

        jBtnNuevo6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inscripciones/Recursos/search_32.png"))); // NOI18N
        jBtnNuevo6.setText("Buscar");
        jBtnNuevo6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnNuevo6ActionPerformed(evt);
            }
        });
        curvesPanel1.add(jBtnNuevo6);
        jBtnNuevo6.setBounds(430, 320, 120, 50);

        javax.swing.GroupLayout imagePanel1Layout = new javax.swing.GroupLayout(imagePanel1);
        imagePanel1.setLayout(imagePanel1Layout);
        imagePanel1Layout.setHorizontalGroup(
            imagePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(curvesPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 597, Short.MAX_VALUE)
        );
        imagePanel1Layout.setVerticalGroup(
            imagePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(curvesPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 519, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(imagePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(imagePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        bindingGroup.bind();

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jBtnNuevo6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnNuevo6ActionPerformed
// TODO add your handling code here:
//    BuscarElecciones be = new BuscarElecciones(null, true, this);
//    be.setLocationRelativeTo(this);
//    be.setVisible(true);
}//GEN-LAST:event_jBtnNuevo6ActionPerformed

private void tblJornadasMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblJornadasMouseClicked
// TODO add your handling code here:
//    if (tblJornadas.getSelectedRow() != -1) {
//        jornadaselect = jornadastemp.get(tblJornadas.getSelectedRow());
//        jdtFecha.setDate(jornadaselect.getFechaInicio());
//        Date fechai = jornadaselect.getFechaInicio();
//        Date fechaf = jornadaselect.getFechaFin();
//        jcbDH.setSelectedItem(validatehour(fechai.getHours()));
//        jcbDM.setSelectedItem(validatehour(fechai.getMinutes()));
//        jcbHH.setSelectedItem(validatehour(fechaf.getHours()));
//        jcbHM.setSelectedItem(validatehour(fechaf.getMinutes()));
//        desactivarcampos();
//    }
}//GEN-LAST:event_tblJornadasMouseClicked

private void btnEdijarjActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEdijarjActionPerformed
// TODO add your handling code here:
//    if (jornadaselect != null) {
//        activarcampos();
//    }
}//GEN-LAST:event_btnEdijarjActionPerformed

private void btnGuardarJActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarJActionPerformed
// TODO add your handling code here:
//    if (jdtFecha.getDate() != null) {
//        if (jornadaselect == null) {
//            Date d = jdtFecha.getDate();
//            JornadaElectoral jr = new JornadaElectoral();
//            jr.setFechaFin(new Date(d.getYear(), d.getMonth(), d.getDate(), Integer.parseInt(jcbHH.getSelectedItem().toString()), Integer.parseInt(jcbHM.getSelectedItem().toString()), 00));
//            jr.setFechaInicio(new Date(d.getYear(), d.getMonth(), d.getDate(), Integer.parseInt(jcbDH.getSelectedItem().toString()), Integer.parseInt(jcbDM.getSelectedItem().toString()), 00));
//            jornadastemp.add(jr);
//            actualizarTabla();
//            limpiarnuevo();
//        } else {
//            Date d = jdtFecha.getDate();
//            jornadastemp.get(tblJornadas.getSelectedRow()).setFechaFin(new Date(d.getYear(), d.getMonth(), d.getDate(), Integer.parseInt(jcbHH.getSelectedItem().toString()), Integer.parseInt(jcbHM.getSelectedItem().toString()), 00));
//            jornadastemp.get(tblJornadas.getSelectedRow()).setFechaInicio(new Date(d.getYear(), d.getMonth(), d.getDate(), Integer.parseInt(jcbDH.getSelectedItem().toString()), Integer.parseInt(jcbDM.getSelectedItem().toString()), 00));
//
//
//            limpiarnuevo();
//        }
//    }
}//GEN-LAST:event_btnGuardarJActionPerformed

private void BtnNuevoJActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnNuevoJActionPerformed
// TODO add your handling code here:
//    limpiarnuevo();
}//GEN-LAST:event_BtnNuevoJActionPerformed

private void btneliminarjActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btneliminarjActionPerformed
// TODO add your handling code here:
//    if (jornadaselect == null) {
//        new Mensajes().StandarWarning(this, "Seleccione la Jornada a Eliminar");
//    } else {
//        jornadastemp.remove(jornadastemp.get(tblJornadas.getSelectedRow()));
//        actualizarTabla();
//        limpiarnuevo();
//    }
}//GEN-LAST:event_btneliminarjActionPerformed

private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed
// TODO add your handling code here:
//    if (validarEleccion()) {
//        if (eleccion.getId() == null) {
//            EleccionDAO edao = new EleccionDAO(eleccion);
//            try {
//                edao.persist();
//            } catch (Exception ex) {
//            }
//            for (JornadaElectoral jor : jornadastemp) {
//                JornadaElectoral jaux = jor;
//                jaux.setEleccion(eleccion);
//                JornadaElectoralDAO j = new JornadaElectoralDAO(jor);
//                try {
//                    j.persist();
//                } catch (Exception ex) {
//                }
//            }
//            new Mensajes().StandarTick(this, "Guardado Exitosamente");
//            this.dispose();
//            btnNuevo.requestFocus();
//            btnNuevoActionPerformed(null);
//        } else {
//            ArrayList<JornadaElectoral> jornadasexistentes = (ArrayList<JornadaElectoral>) new ConsultasBD().buscarPOR("JornadaElectoral", "eleccion", "'" + eleccion.getId() + "'");
//            for (JornadaElectoral j : jornadasexistentes) {
//                JornadaElectoralDAO jdao = new JornadaElectoralDAO(j);
//                try {
//                    jdao.update();
//                    jdao.remove();
//                } catch (Exception ex) {
//                }
//            }
//            EleccionDAO edao = new EleccionDAO(eleccion);
//            try {
//                edao.update();
//            } catch (Exception ex) {
//            }
//            for (JornadaElectoral j : jornadastemp) {
//                JornadaElectoral jaux = j;
//                jaux.setEleccion(eleccion);
//                JornadaElectoralDAO jdao = new JornadaElectoralDAO(jaux);
//                try {
//                    jdao.update();
//                    jdao.persist();
//
//                } catch (Exception ex) {
//                }
//            }
//            new Mensajes().StandarTick(this, "Actualizado Con Éxito");
//            this.dispose();
//            btnNuevo.requestFocus();
//            btnNuevoActionPerformed(null);
//        }
//    } else {
//        new Mensajes().StandarWarning(this, "Ingrese todos los Datos Antes de Guardar");
//    }
}//GEN-LAST:event_btnGuardarActionPerformed

private void jBtnNuevo3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnNuevo3ActionPerformed
// TODO add your handling code here:
//    if (eleccion.getId() != null) {
//        if (new Mensajes().ConfirmacionDialogowarning(this, "¿Desea Eliminar Ésta Elección?") == 0) {
//
//            ArrayList<EleccionActual> elecact = (ArrayList<EleccionActual>) new ConsultasBD().buscarPOR("EleccionActual", "eleccion", "'" + eleccion.getId() + "'");
//            if (!elecact.isEmpty()) {
//                new Mensajes().StandarWarning(this, "No se puede Eliminar. Ésta Eleccion ya Ha Sido Ejecutada");
//                return;
//            }
//
//            EleccionDAO edao = new EleccionDAO(eleccion);
//            try {
//                edao.update();
//                edao.remove();
//                new Mensajes().StandarTick(this, "Eliminado Con Éxito");
//                this.dispose();
//                btnNuevo.requestFocus();
//                btnNuevoActionPerformed(null);
//
//            } catch (Exception ex) {
//                new Mensajes().StandarWarning(this, "No se puedo Eliminar");
//            }
//        }
//    } else {
//        new Mensajes().StandarWarning(this, "Cargue la Elección Que Desea Eliminar");
//    }
}//GEN-LAST:event_jBtnNuevo3ActionPerformed

private void jBtnNuevo2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnNuevo2ActionPerformed
// TODO add your handling code here:
//    if (eleccion.getId() != null) {
//        activarcampostotales();
//        activarcampos();
//    } else {
//        new Mensajes().StandarWarning(this, "Primero Cargue la Elección.");
//    }
}//GEN-LAST:event_jBtnNuevo2ActionPerformed

private void btnNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevoActionPerformed
// TODO add your handling code here:
    AdministrarJornada ae = new AdministrarJornada(null, true);
    ae.setLocationRelativeTo(this);
    ae.setVisible(true);
}//GEN-LAST:event_btnNuevoActionPerformed

private void jBtnNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnNuevoActionPerformed
// TODO add your handling code here:
    this.dispose();
}//GEN-LAST:event_jBtnNuevoActionPerformed

    /**
     * @param args the command line arguments
     */
    

//    public Eleccion getEleccion() {
//        return eleccion;
//    }
//
//    public void setEleccion(Eleccion eleccion) {
//        this.eleccion = eleccion;
//    }
//
//    public ArrayList<JornadaElectoral> getJornadas() {
//        return jornadas;
//    }
//
//    public void setJornadas(ArrayList<JornadaElectoral> jornadas) {
//        this.jornadas = jornadas;
//    }
//
//    public JTabbedPane getjTabbedPane1() {
//        return jTabbedPane1;
//    }
//
//    public void setjTabbedPane1(JTabbedPane jTabbedPane1) {
//        this.jTabbedPane1 = jTabbedPane1;
//    }

   
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BtnNuevoJ;
    private javax.swing.JButton btnEdijarj;
    private javax.swing.JButton btnGuardar;
    private javax.swing.JButton btnGuardarJ;
    private javax.swing.JButton btnNuevo;
    private javax.swing.JButton btneliminarj;
    private com.mycsistemas.swingec.panel.CurvesPanel curvesPanel1;
    private com.mycsistemas.swingec.panel.ImagePanel imagePanel1;
    private javax.swing.JButton jBtnNuevo;
    private javax.swing.JButton jBtnNuevo2;
    private javax.swing.JButton jBtnNuevo3;
    private javax.swing.JButton jBtnNuevo6;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLblAlias1;
    private javax.swing.JLabel jLblNombre;
    private javax.swing.JLabel jLblNombre2;
    private javax.swing.JLabel jLblNombre3;
    private javax.swing.JLabel jLblNombre4;
    private javax.swing.JLabel jLblPartidoElectoral;
    private javax.swing.JPanel jPanelCandidatos;
    private javax.swing.JPanel jPanelCandidatos1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JComboBox jcbDH;
    private javax.swing.JComboBox jcbDM;
    private javax.swing.JComboBox jcbEstado;
    private javax.swing.JComboBox jcbHH;
    private javax.swing.JComboBox jcbHM;
    private com.toedter.calendar.JDateChooser jdtFecha;
    private javax.swing.JTable tblJornadas;
    private javax.swing.JTextField txttitulo;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables

    private void desactivarcampos() {
        jdtFecha.setEnabled(false);
        jcbDH.setEnabled(false);
        jcbDM.setEnabled(false);
        jcbHH.setEnabled(false);
        jcbHM.setEnabled(false);
    }

    private void activarcampos() {
        jdtFecha.setEnabled(true);
        jcbDH.setEnabled(true);
        jcbDM.setEnabled(true);
        jcbHH.setEnabled(true);
        jcbHM.setEnabled(true);
    }
//
//    private void actualizarTabla() {
//        ModelTableJornadas model = new ModelTableJornadas(jornadastemp);
//        tblJornadas.setModel(model);
//        tblJornadas.updateUI();
//    }
//
//    private void actualizarTablaElectores() {
//
//        eleccionelectores = (ArrayList<EleccionElector>) new ConsultasBD().buscarPOR("EleccionElector", "eleccion", "'" + eleccion.getId() + "'");
//        electores.clear();
//        elect();
//        ModelTableElector model = new ModelTableElector(electores);
//        tblElectores.setModel(model);
//        tblElectores.updateUI();
//    }
//
//    private void actualizarTablaListas() {
//        eleccionlistas = (ArrayList<EleccionListas>) new ConsultasBD().buscarPOR("EleccionListas", "eleccion", "'" + eleccion.getId() + "'");
//        listas.clear();
//        elist();
//        ModelTablePartido model = new ModelTablePartido(listas);
//        tbllistas.setModel(model);
//        tbllistas.updateUI();
//    }
//
//    private boolean validarEleccion() {
//        if (!txttitulo.getText().isEmpty()) {
//            if (!jornadastemp.isEmpty()) {
//                if (!jcbEstado.getSelectedItem().toString().isEmpty()) {
////                    return true;
//                }
//            }
//        }
//        return false;
//    }
//
//    private void limpiarnuevo() {
//        jdtFecha.setDate(new Date());
//        jcbDH.setSelectedIndex(0);
//        jcbDM.setSelectedIndex(0);
//        jcbHH.setSelectedIndex(0);
//        jcbHM.setSelectedIndex(0);
//        jornadaselect = null;
//        activarcampos();
//    }

    private void desactivarcampostotales() {
        txttitulo.setEnabled(false);
        jcbEstado.setEnabled(false);
        btnEdijarj.setEnabled(false);
        btnGuardarJ.setEnabled(false);
        btneliminarj.setEnabled(false);
        tblJornadas.setEnabled(false);
        BtnNuevoJ.setEnabled(false);
    }

    private void activarcampostotales() {
        txttitulo.setEnabled(true);

        BtnNuevoJ.setEnabled(true);
        btnEdijarj.setEnabled(true);
        btnGuardarJ.setEnabled(true);
        btneliminarj.setEnabled(true);
        tblJornadas.setEnabled(true);
    }

//    private void elect() {
//        for (EleccionElector e : eleccionelectores) {
//            electores.add(e.getElector());
//        }
//
//    }
//
//    private void elist() {
//        for (EleccionListas e : eleccionlistas) {
//            listas.add(e.getPartido());
//        }
//
//    }
//
//    private String validatehour(int hora) {
//        if (hora < 10) {
//            return "0" + String.valueOf(hora);
//        } else {
//            return String.valueOf(hora);
//        }
//    }
}
